package com.ss.android.article.browser.database.b;

import android.content.ContentValues;
import android.database.Cursor;
import android.support.annotation.NonNull;
import com.a.a.NightMode;
import com.ss.android.article.browser.database.BrowserHistory;

public final class d implements NightMode {
    private final HistoryManager c;
    private final String a;
    private final String b;

    public d(HistoryManager arg1, String arg2, String arg3) {
        this.c = arg1;
        this.a = arg2;
        this.b = arg3;

    }

    public final void f(@NonNull Object arg13) {
        String v6 = null;
        ContentValues v10 = new ContentValues();
        String v2 = "title";
        String v0 = this.a == null ? "" : this.a;
        v10.put(v2, v0);
        v10.put("time", Long.valueOf(System.currentTimeMillis()));
        Cursor v2_1 = HistoryManager.getDatabase(this.c).query(false, "history", new String[]{"url"}, "url = ?", new String[]{this.b}, v6, v6, v6, "1");
        if(v2_1.getCount() > 0) {
            HistoryManager.getDatabase(this.c).update("history", v10, "url = ?", new String[]{this.b});
        }
        else {
            HistoryManager v1 = this.c;
            String v4 = this.b;
            v0 = this.a == null ? "" : this.a;
            HistoryManager.a(v1, new BrowserHistory(v4, v0));
        }

        v2_1.close();
    }
}

